import { request } from 'umi';

/** 获取菜单列表 */
export async function getMenuTree() {
  return request<Record<string, any>>('/api/menuTree', {
    method: 'GET',
  });
}

/** 获取菜单信息 */
export async function getMenuInfo(params: MENU.QueryMenuParams, options?: Record<string, any>) {
  return request<Record<string, any>>('/api/menuTree', {
    method: 'GET',
    params,
    ...(options || {}),
  });
}

/** 新增菜单 */
export async function addMenu(data: MENU.AddMenuParams, options?: Record<string, any>) {
  return request<Record<string, any>>('/api/menu', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}
/** 编辑菜单 */
export async function editMenu(data: MENU.EditMenuParams, options?: Record<string, any>) {
  return request<Record<string, any>>('/api/menu', {
    method: 'PUT',
    data,
    ...(options || {}),
  });
}
/** 删除菜单 */
export async function deleteMenu(params: MENU.DeleteMenuParams, options?: Record<string, any>) {
  return request<Record<string, any>>('/api/menu', {
    method: 'DELETE',
    params,
    ...(options || {}),
  });
}
